<template>
  <a-layout id="components-layout-demo-custom-trigger" :style="{ height: '100%' , width:'100%'}">
    <a-layout-header style="background: #001529; padding: 2px">
      <Top/>
    </a-layout-header>

    <a-layout>

      <a-layout-sider>
        <div class="logo" />
        <a-menu theme="dark" mode="inline" :default-selected-keys="['1']" :selectedKeys="selectedKey">
          <a-menu-item key="/">
            <a-icon type="home" />
            <span>主页</span>
            <router-link to="/"></router-link>
          </a-menu-item>
          <a-menu-item key="/myorder">
            <a-icon type="unordered-list" />
            <span>我的订单</span>
            <router-link to="/myorder"></router-link>
          </a-menu-item>
          <a-menu-item key="/login">
            <a-icon type="home" />
            <span>登录</span>
            <router-link to="/login"></router-link>
          </a-menu-item>
          <a-menu-item key="/register">
            <a-icon type="usergroup-add" />
            <span>注册</span>
            <router-link to="/register"></router-link>
          </a-menu-item>

        </a-menu>
      </a-layout-sider>

      <a-layout-content
          :style="{ margin: '24px 16px', padding: '24px', background: '#fff', height: '94%' , width:'100%'}"
      >
        <router-view/>
      </a-layout-content>

    </a-layout>
  </a-layout>
</template>

<script>
import Top from '@/components/Top.vue'
export default {
  name: 'App',
  components: {
    Top
  },
  computed:{
    selectedKey:function (){
      return [this.$route.path]
    }
  },
  data:function (){
    return {
      }
  }
}
</script>

<style lang="scss">

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
#components-layout-demo-top-side .logo {
  width: 120px;
  height: 31px;
  background: rgba(255, 255, 255, 0.2);
  margin: 16px 28px 16px 0;
  float: left;
}
</style>
